import request from '@/utils/request'
import MODULE from '@/utils/module'

export function getList(data, currentPage, pageSize) {
  return request({
    url: MODULE.MODULE.goodsOnSaleDetail + '/GoodsOnSaleDetail/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
    method: 'post',
    params: {},
    data: data,
    transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
      data = JSON.stringify(data)
      return data
    }],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function doDelete(id) {
  return request({
    url: MODULE.MODULE.goodsOnSaleDetail + '/GoodsOnSaleDetail/remove',
    method: 'delete',
    params: { id }
  })
}

// 编辑
export function doEdit(data) {
  return request({
    url: MODULE.MODULE.goodsOnSaleDetail + '/GoodsOnSaleDetail/edit',
    method: 'PATCH',
    params: {},
    data: data,
    transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
      data = JSON.stringify(data)
      return data
    }],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
